/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.bean;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Zully
 */
@Entity
@Table(name = "marcas_vehiculo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MarcasVehiculo.findAll", query = "SELECT m FROM MarcasVehiculo m"),
    @NamedQuery(name = "MarcasVehiculo.findById", query = "SELECT m FROM MarcasVehiculo m WHERE m.id = :id"),
    @NamedQuery(name = "MarcasVehiculo.findByNombre", query = "SELECT m FROM MarcasVehiculo m WHERE m.nombre = :nombre"),
    @NamedQuery(name = "MarcasVehiculo.findByEstado", query = "SELECT m FROM MarcasVehiculo m WHERE m.estado = :estado")})
public class MarcasVehiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "estado")
    private boolean estado;
    @OneToMany(mappedBy = "idMarca", fetch = FetchType.LAZY)
    private List<Vehiculos> vehiculosList;

    public MarcasVehiculo() {
    }

    public MarcasVehiculo(Integer id) {
        this.id = id;
    }

    public MarcasVehiculo(Integer id, String nombre, boolean estado) {
        this.id = id;
        this.nombre = nombre;
        this.estado = estado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public boolean getEstado() {
        return estado;
    }

    public void setEstado(boolean estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<Vehiculos> getVehiculosList() {
        return vehiculosList;
    }

    public void setVehiculosList(List<Vehiculos> vehiculosList) {
        this.vehiculosList = vehiculosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MarcasVehiculo)) {
            return false;
        }
        MarcasVehiculo other = (MarcasVehiculo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }
    
}
